/* eslint-disable no-unused-vars */
import * as echarts from 'echarts'

const BarLine3Option = ({
  dataList,
  xdata,
  ColorArr,
  lineIcon,
  legend,
  grid,
}) => {
  let options = {
    tooltip: {
      trigger: 'axis',
    },
    grid: {
      top: 40,
      left: 40,
      right: 20,
      bottom: 45,
    },
    xAxis: [
      {
        type: 'category',
        data: xdata,
        axisLine: {
          lineStyle: {
            color: 'rgba(255, 255, 255, 0.12)',
          },
        },
        axisPointer: {
          type: 'shadow',
        },
        axisTick: {
          show: false,
        },
        splitLine: {
          show: false,
        },
        axisLabel: {
          color: '#a0b4ba',
        },
        splitArea: {
          show: true,
        },
      },
    ],
    yAxis: [
      {
        type: 'value',
        axisLine: {
          show: false,
          lineStyle: {
            color: '#a0b4ba',
          },
        },
        splitNumber: 4,
        axisLabel: {
          color: '#a0b4ba',
          formatter: '{value}',
        },
        axisTick: {
          show: false,
        },
        splitLine: {
          show: true,
          lineStyle: {
            color: '#D4D6E1',
            type: 'dashed',
          },
        },
      },
      {
        type: 'value',
        axisLine: {
          show: false,
          lineStyle: {
            color: '#a0b4ba',
          },
        },
        splitNumber: 4,
        axisLabel: {
          show: false,
          color: '#a0b4ba',
          formatter: '{value}',
        },
        axisTick: {
          show: false,
        },
        splitLine: {
          show: false,
        },
      },
    ],
    series: [
      {
        name: dataList[0].name,
        type: 'bar',
        barWidth: 10,
        barGap: '11',
        itemStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            { offset: 0, color: '#D7E0F7' },
            { offset: 1, color: '#1699FE' },
          ]),
        },
        data: dataList[0].value,
        label: {
          show: true,
          position: 'top',
          distance: 20,
          height: 3,
          width: 10,
          color: '#206EF2',
          formatter: ['{c}', '{b|}'].join('\n'),
          rich: {
            b: {
              lineHeight: 20,
              backgroundColor: '#159AFF',
              borderWidth: 1,
              height: 3,
              width: 10,
            },
          },
        },
      },
      {
        name: dataList[1].name,
        type: 'line',
        yAxisIndex: 1,
        symbolSize: 10,
        lineStyle: {
          color: '#DFE7F4',
          width: 1,
        },
        data: dataList[1].value,
        symbol: lineIcon,
      },
    ],
  }
  return options
}

export { BarLine3Option }
